import { createRouter, createWebHistory } from 'vue-router';

const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import('./components/Home.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('./components/Login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('./components/Register.vue')
  },
  {
    path: '/posts',
    name: 'Articles',
    component: () => import('./components/Articles.vue')
  },
  {
    path: '/posts/:id',
    name: 'ArticleDetail',
    component: () => import('./components/ArticleDetail.vue')
  },
  {
    path: '/posts/create',
    name: 'CreateArticle',
    component: () => import('./components/ArticleEdit.vue')
  },
  {
    path: '/posts/edit/:id',
    name: 'EditArticle',
    component: () => import('./components/ArticleEdit.vue')
  },
  {
    path: '/admin',
    name: 'Admin',
    component: () => import('./components/Admin.vue')
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;